package cn.ncupyh.service;

import cn.ncupyh.dao.UserDao;
import cn.ncupyh.entity.User;

import java.sql.SQLException;

public class UserService {
    private UserDao userDao;

    public UserDao getUserDao() {
        return userDao;
    }

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }

    public UserService(UserDao userDao) {
        this.userDao = userDao;
    }

    public UserService() {
    }

    //注册:
    public boolean registerUser(String uname, String upassword) throws SQLException {
        User user = new User();
        UserDao userDao = new UserDao();
        user.setUname(uname);
        user.setUpassword(upassword);
        boolean flag = userDao.addUser(user);
//        if(){
//
//        }
        return flag;
    }

}
